package teshop.web;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import teshop.data.domain.Product;
import teshop.service.CatalogService;


@SuppressWarnings("serial")
@Component("catalog")
@Scope("request")
public class Catalog implements Serializable {

	/**
	 * Spring Catalog service
	 */
	private CatalogService service;

	private List<Product> products;

	@Autowired
	public Catalog(CatalogService service) {
		this.service = service;
		products = this.service.getItems(0, 10);
	}

	public List<Product> getItems() {
		return products;
	}

	public void setItems(List<Product> items) {
		this.products = items;
	}

}
